class WeaponData:

	var lv
	var config
	var count = 1

	func getProperties(entityData):
		var result = {}
		
		var props = [Consts.PROP_NAME, Consts.PROP_TYPE, Consts.PROP_ATTACK_TYPE, Consts.PROP_STORY, Consts.PROP_REQUIRE_STRENGTH, Consts.PROP_REQUIRE_INTELLIGENCE, Consts.PROP_REQUIRE_DEXTERITY, Consts.PROP_REQUIRE_LUCKY, Consts.PROP_STRENGTH_BONUS, Consts.PROP_INTELLIGENCE_BONUS, Consts.PROP_DEXTERITY_BONUS, Consts.PROP_LUCKY_BONUS]
		for prop in props:
			result[prop] = config.get(prop)
		
		result[Consts.PROP_TYPE_NAME] = ConfigClasses.WeaponTypeConfig.configsDict[config.type].name 
		result[Consts.PROP_ATTACK_TYPE_NAME] = ConfigClasses.AttackTypeConfig.configsDict[config.attackType].name
		
		#attibuteaffectprops
		var attributeAffectProps = [Consts.PROP_PHYSICAL_ATTACK, Consts.PROP_FIRE_ATTACK, Consts.PROP_THUNDER_ATTACK, Consts.PROP_POISON, Consts.PROP_BLEED, Consts.PROP_SLEEP, Consts.PROP_MADNESS, Consts.PROP_DEAD, Consts.PROP_FROST]
		var propsWithEntity = entityData.calcPropertiesByWeapon(self)
		for prop in attributeAffectProps:
			result[prop] = propsWithEntity.get(prop)
			
		#other
		result[Consts.PROP_CRITICAL] = critical()
		result[Consts.PROP_CRITICAL_DAMAGE] = criticalDamage()
		result[Consts.PROP_AVOID] = avoid()
		
		result[Consts.PROP_CRITICAL_PERCENT] = float(result[Consts.PROP_CRITICAL]) * 100.0
		result[Consts.PROP_CRITICAL_DAMAGE_PERCENT] = float(result[Consts.PROP_CRITICAL_DAMAGE]) * 100.0
		result[Consts.PROP_AVOID_PERCENT] = float(result[Consts.PROP_AVOID]) * 100.0
		result[Consts.PROP_LV] = lv
		
		return result
		
	
	func critical():
		return float(config.critical) * lvBonusPercent()
		
	
	func criticalDamage():
		return float(config.criticalDamage) * lvBonusPercent()
		
	
	func avoid():
		return float(config.avoid) * lvBonusPercent()


	func lvBonusPercent():
		return float(ConfigClasses.WeaponLevelConfig.configsDict[str(lv)].percent)
		


